<template>
    <el-dropdown 
    class="disliked-dropdown"
    trigger="click"
    @command="handleCommand"
    >
        <slot></slot>

        <el-dropdown-menu slot="dropdown">
            <el-dropdown-item command="self">屏蔽本条内容</el-dropdown-item>
        </el-dropdown-menu>
    </el-dropdown>
</template>

<script>
export default {
    props: {
        // 本条数据的主键
        rowguid: {
            type: String,
            default: '',
        },
        // 本条数据的类型（文章、文件等）
        type: {
            type: String,
            default: '',
        },
    },
    data() {
        return {
            
        };
    },
    methods: {
        handleCommand(command) {
            var switchObj = {
                self: () => {
                    this.$post(`${this.$store.state.api.tbUrl}/disliked/form.json`, [
                        {
                            objectguid: this.rowguid,
                            objecttype: this.type,
                        },
                    ], data => {
                        this.$emit('shield');
                    }, true);
                },
            };

            switchObj[command]();
        },
    },
    mounted() {
        
    },
};
</script>

<style lang="scss" scoped>

</style>